<template>
	<!-- 顶部用户信息 -->
	<view class="section_one" style="display: flex;justify-content: space-between;align-items: center;">
		<!-- 用户信息  左-->
		<view @click="toWxLogin()" class="touxiang_left"
			style="display: flex;justify-content: space-between;align-items: center;">
			<u-avatar size="large" style="align-items: center;justify-content: center;display: flex;" class="avartar_left" :src="userpic || null"></u-avatar>

			<!--  -->
			<view class="userInfo" style="margin-left: 20px;">
				<!-- 用户名字 -->
				<view class="user_name" style="display: flex;">
					<view class="" style="font-weight: bold;font-size: larger;">
						{{nickname}}
					</view>

					<!-- <view class="tip" style="margin-left: 10px;color: aquamarine;">
						<u-icon style="margin-left: 8px;" size="30" name="checkbox-mark"></u-icon>
						交易成功
					</view> -->
				</view>
				<!-- 会员内容 -->
				<view class="user_content">
					<view class="" style="color: #ccc;font-size: 12px;margin-top: 2px;">
						会员名：暂无
					</view>
				</view>
				<!-- 消息时间 -->
				<view class="user_time" style="margin-top: 5px;">
					<p style="font-size: 13px;">关注 1|粉丝 1|勋章 0</p>
				</view>
			</view>
		</view>

		<!-- 设置客服 -->
		<view class="">

			<u-icon size="40" name="kefu-ermai"></u-icon>

		</view>
	</view>
</template>

<script>
	import {
		mapActions
	} from 'vuex';
	export default {
		data() {
			return {

			}
		},
		methods: {
			...mapActions('user', ['initUserInfoFromCache']),

			toWxLogin() {
				uni.navigateTo({
					url: '/pages/login/login'
				});
			}
		},
		created() {
			this.initUserInfoFromCache();
		},

		computed: {
			userpic() {

				// 获取store中的状态

				return this.$store.state.user.userInfo.userpic

			},
			nickname() {
				return this.$store.state.user.userInfo.nickname
			}
		}

	}
</script>


<style lang="scss" scoped>
	.section_one {
		margin-top: 20px;
		margin:0 20px;
		.touxiang_left {
			.avartar_left {

				height: 100px;
				height: 100px;
			}
		}
	}
</style>